
package com.rattsoftware.client.model;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;

import com.rattsoftware.server.admin.model.Course;
import com.rattsoftware.server.admin.model.CourseUnit;
import com.rattsoftware.server.admin.model.Department;
import com.rattsoftware.server.admin.model.Faculty;
import com.rattsoftware.server.admin.model.Permission;
import com.rattsoftware.server.admin.model.RattsModelConstants;
import com.rattsoftware.server.admin.model.Role;
import com.rattsoftware.server.admin.model.Room;
import com.rattsoftware.server.admin.model.Staff;
import com.rattsoftware.server.admin.model.User;

public class TestData {

	private static final String[] months = new String[] { "Jan", "Feb", "Mar",
		"Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };

	public static String[] getMonths() {
		return months;
	}

	public static String[] getShortMonths(int n) {
		String[] mths = new String[n];
		for (int c = 0; c < n; c++)
			mths[c] = months[c];
		return mths;
	}

	public static List<User> getUsers() {
		List<User> users = new ArrayList<User>();

		User user1 = new User();
		user1.setUsername("tom");
		user1.setEmail("gll86bu@gmail.com");
		user1.setLastName("Elly");
		user1.setFirstName("Businge");
		user1.setId("1");
		user1.setPhoneNumber("256782093837");
		user1.getRoles().add(getRole());

		User user2 = new User();
		user2.setUsername("Frusher2");
		user2.setEmail("hjs86bu@gmail.com");
		user2.setLastName("Luis");
		user2.setFirstName("Ben");
		user2.setId("2");
		user2.setPhoneNumber("256782542442");

		User user3 = new User();
		user3.setUsername("Ken");
		user3.setEmail("yes86bu@gmail.com");
		user3.setLastName("Gerald");
		user3.setFirstName("Magezi");
		user3.setId("3");
		user3.setPhoneNumber("256782429827");

		users.add(user1);
		users.add(user2);
		users.add(user3);

		return users;
	}

	public static Role getRole() {
		
		Role role1 = new Role("ADMIN");
		//role1.setPermissions(getPermissions());
		return role1;
	}
	
	public static List<Permission> getPermissions() {
		List<Permission> permissions = new ArrayList<Permission>();
		
		permissions.add(new Permission(Permission.PERM_ADD_ROLES));
		permissions.add(new Permission(Permission.PERM_ADD_USERS));
		permissions.add(new Permission(Permission.PERM_LIST_USERS));
		
		permissions.add(new Permission(Permission.PERM_DELETE_ROLES));
		permissions.add(new Permission(Permission.PERM_DELETE_USERS));
		permissions.add(new Permission(Permission.PERM_VIEW_ROLES));
		
		return permissions;
	}
	
	public static List<Department> getDepartments() {
		List<Department> departments = new ArrayList<Department>();
		
		Department dept1 = new Department();
		dept1.setName("Dept. Of Computer Science");
		dept1.setHod("Mr. Businge Elly");
		dept1.setId("1");
		dept1.setDescription("Computer Science Department");
		//dept1.setListOfCourses(getCourses());
		
		Department dept2 = new Department();
		dept2.setName("Dept. Of Computer Science");
		dept2.setHod("Mr. Businge Elly");
		dept2.setId("2");
		dept2.setDescription("Computer Science Department");
		//dept2.setListOfCourses(getCourses());
		
		departments.add(dept1);
		departments.add(dept2);
		return departments;
	}
	
	public static Department getDepartment1(){
		Department dept1 = new Department();
		dept1.setName("Dept. Of Computer Science");
		dept1.setHod("Mr. Businge Elly");
		dept1.setId("1");
		dept1.setDescription("Computer Science Department");
		//dept1.setListOfCourses(getCourses());
		return dept1;
	}
	
	public static Department getDepartment2(){
		Department dept2 = new Department();
		dept2.setName("Dept. Of Computer Science");
		dept2.setHod("Mr. Businge Elly");
		dept2.setId("2");
		dept2.setDescription("Computer Science Department");
		//dept2.setListOfCourses(getCourses());
		return dept2;
	}
	
	public static List<Course> getCourses() {
		List<Course> courses = new ArrayList<Course>();
		
		Course course1 = new Course();
		course1.setName("Bachelors Of IT");
		course1.setDescription("Information Technology at its best");
		course1.setDuration("3");
		course1.setShortname("BIT");
		course1.getCourseUnits().addAll(getCourseUnits());
		course1.setType(RattsModelConstants.COURSE_DIPLOMA);
		course1.setDepartment(getDepartment2());
		course1.setId("1");
		course1.setNumOfCourseunits(Integer.toString(getCourseUnits().size()));
		
		
		Course course2 = new Course();
		course2.setName("Bachelors Of Software Engineering");
		course2.setDescription("Teaches a student the best software engineering practices");
		course2.setDuration("4");
		course2.setShortname("CSC");
		course2.getCourseUnits().addAll(getCourseUnits());
		course2.setType(RattsModelConstants.COURSE_UNDERGRADUATE);
		course2.setDepartment(getDepartment1());
		course2.setId("2");
		course2.setNumOfCourseunits(Integer.toString(getCourseUnits().size()));
		
		courses.add(course1);
		courses.add(course2);
		return courses;
	}
	
	public static List<CourseUnit> getCourseUnits() {
		List<CourseUnit> courseUnits = new ArrayList<CourseUnit>();
		
		CourseUnit courseUnit1 = new CourseUnit();
		courseUnit1.setCourseCode("CSC 1102");
		courseUnit1.setName("Principles Of Programming");
		courseUnit1.setType(RattsModelConstants.COURSE_UNIT_CORE);
		courseUnit1.setNumOfCreditUnits("4");
		courseUnit1.setDescription("Testing Data");
		courseUnit1.setId("1");
		courseUnit1.setSemester(RattsModelConstants.SEMESTER_ONE);
		courseUnit1.setYear(RattsModelConstants.YEAR_ONE);
		
		CourseUnit courseUnit2 = new CourseUnit();
		courseUnit2.setCourseCode("CSC 2104");
		courseUnit2.setName("Programming Methodology");
		courseUnit2.setType(RattsModelConstants.COURSE_UNIT_ELECTIVE);
		courseUnit2.setNumOfCreditUnits("3");
		courseUnit2.setDescription("Test Data");
		courseUnit2.setId("2");
		courseUnit2.setSemester(RattsModelConstants.SEMESTER_ONE);
		courseUnit2.setYear(RattsModelConstants.YEAR_TWO);
		
		courseUnits.add(courseUnit1);
		courseUnits.add(courseUnit2);
		return courseUnits;
	}
	
	public static List<Faculty> getFaculties() {
		List<Faculty> faculties = new ArrayList<Faculty>();
		
		Faculty faculty1 = new Faculty();
		faculty1.setId("1");
		faculty1.setName("Faculty Of Computing And IT");
		faculty1.setDean("Mr. Agaba John");
		faculty1.setDescription("Test description data for FCIT");
		faculty1.setLocation("Kampala (U)");
		faculty1.setNumOfDepartments("12");
		faculty1.setDepartments(new HashSet<Department>(getDepartments()));
		
		Faculty faculty2 = new Faculty();
		faculty2.setId("2");
		faculty2.setName("Faculty Of Social Sciences");
		faculty2.setDean("Mr. Businge Elly");
		faculty2.setDescription("Test description data for FSS");
		faculty2.setLocation("Kampala (U)");
		faculty2.setNumOfDepartments("20");
		faculty2.setDepartments(new HashSet<Department>(getDepartments()));
		
		Faculty faculty3 = new Faculty();
		faculty3.setId("3");
		faculty3.setName("Faculty Of Technology");
		faculty3.setDean("Mr. Tom Mugerwa");
		faculty3.setDescription("Test description data for FT");
		faculty3.setLocation("Kampala (U)");
		faculty3.setNumOfDepartments("13");
		faculty3.setDepartments(new HashSet<Department>(getDepartments()));
		
		faculties.add(faculty1);
		faculties.add(faculty2);
		faculties.add(faculty3);
		
		return faculties;
	}
	
	public static List<Staff> getStaff() {
		List<Staff> staff = new ArrayList<Staff>();
		
		Staff staff1 = new Staff();
		staff1.setId("1");
		staff1.setFirstName("Mpango");
		staff1.setLastName("Jonathan");
		staff1.setDob("19-03-1976");
		staff1.setGender("Male");
		//staff1.setEmploymentType(RattsModelConstants.EMPLOYMENT_TYPE_PERMANENT);
		staff1.setEmail("jmpango@yahoo.com");
		//staff1.setPhoneNumber("256783928222");
		//staff1.setResidentialAddress("Bukoto, Kampala(U)");
		staff1.setTitle(RattsModelConstants.TITLE_DOCTOR);
		staff1.setType(RattsModelConstants.STAFF_TYPE_FULL_TIMER);
		staff1.setDepartment(getDepartment1());
		
		Staff staff2 = new Staff();
		staff2.setId("2");
		staff2.setFirstName("Byamukama");
		staff2.setLastName("Edward");
		staff2.setDob("04-08-1980");
		staff2.setGender("Male");
		//staff2.setEmploymentType(RattsModelConstants.EMPLOYMENT_TYPE_CONTRACT);
		staff2.setEmail("bya_ed@yahoo.com");
		//staff2.setPhoneNumber("256782456231");
		//staff2.setResidentialAddress("Entebbe, Kampala(U)");
		staff2.setTitle(RattsModelConstants.TITLE_PROFESSOR);
		staff2.setType(RattsModelConstants.STAFF_TYPE_PART_TIMER);
		staff2.setDepartment(getDepartment2());
	
		Staff staff3 = new Staff();
		staff3.setId("3");
		staff3.setFirstName("Revo");
		staff3.setLastName("Ritah");
		staff3.setDob("11-12-1950");
		staff3.setGender("Female");
		//staff3.setEmploymentType(RattsModelConstants.EMPLOYMENT_TYPE_CONTRACT);
		staff3.setEmail("revo@yahoo.com");
		//staff3.setPhoneNumber("256782345512");
		//staff3.setResidentialAddress("Ntinda, Kampala(U)");
		staff3.setTitle(RattsModelConstants.TITLE_MRS);
		staff3.setType(RattsModelConstants.STAFF_TYPE_FULL_TIMER);
		staff3.setDepartment(getDepartment2());
		
		staff.add(staff1);
		staff.add(staff2);
		staff.add(staff3);
		return staff;
	}
	
	public static List<Room> getRooms() {
		List<Room> rooms = new ArrayList<Room>();
		
		Room room1 = new Room();
		room1.setId("1");
		room1.setCapacity("100");
		room1.setLevel("Level 1");
		room1.setRoomcategory(RattsModelConstants.ROOM_CATEGORY_LECTURE_ROOM);
		room1.setRoomNumber("202");
		room1.setRoomstate(RattsModelConstants.ROOM_STATE_FREE);
		room1.setRoomsize(RattsModelConstants.ROOM_SIZE_MEDIUM);
		
		Room room2 = new Room();
		room2.setId("2");
		room2.setCapacity("50");
		room2.setLevel("Level 4");
		room2.setRoomcategory(RattsModelConstants.ROOM_CATEGORY_LABARATORY);
		room2.setRoomNumber("210");
		room2.setRoomstate(RattsModelConstants.ROOM_STATE_FREE);
		room2.setRoomsize(RattsModelConstants.ROOM_SIZE_SMALL);
		
		Room room3 = new Room();
		room3.setId("3");
		room3.setCapacity("500");
		room3.setLevel("Level 2");
		room3.setRoomcategory(RattsModelConstants.ROOM_CATEGORY_LECTURE_ROOM);
		room3.setRoomNumber("211");
		room3.setRoomstate(RattsModelConstants.ROOM_STATE_FREE);
		room3.setRoomsize(RattsModelConstants.ROOM_SIZE_BIG);
		
		rooms.add(room1);
		rooms.add(room2);
		rooms.add(room3);
		
		return rooms;
	}
}
